package touche.touche;

import model.GameManager;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class PauseActivity extends Activity implements View.OnClickListener {
	private Button _buttonResumeGame;
	private Button _buttonNewGame;
	private Button _buttonHelp;
	private Button _buttonMenu;

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.pause);
		_buttonResumeGame = (Button) findViewById(R.id.buttonResumeGame);
		_buttonResumeGame.setOnClickListener(this);

		_buttonNewGame = (Button) findViewById(R.id.buttonNewGame);
		_buttonNewGame.setOnClickListener(this);

		_buttonHelp = (Button) findViewById(R.id.buttonHelp);
		_buttonHelp.setOnClickListener(this);

		_buttonMenu = (Button) findViewById(R.id.buttonMenu);
		_buttonMenu.setOnClickListener(this);
		
		
		Intent thisIntent = getIntent();
		TextView textViewTitle = (TextView) findViewById(R.id.textViewTitle);
		textViewTitle.setText(thisIntent.getExtras().getString("levelName"));
		
	
		TextView textViewScore = (TextView) findViewById(R.id.textViewScore);
		textViewScore.setText(new String(String.valueOf(thisIntent.getExtras().getInt("score"))));

		TextView textViewTime = (TextView) findViewById(R.id.textViewTime);
		textViewTime.setText(new String(String.valueOf(thisIntent.getExtras().getInt("time"))));
		
		TextView textViewLife = (TextView) findViewById(R.id.textViewLife);
		textViewLife.setText(new String(String.valueOf(thisIntent.getExtras().getInt("life"))));
	}

	public void onClick(View v) {
		if (_buttonResumeGame == v) {
			finish();
		} else if (_buttonNewGame == v) {
			finish();
			GameManager.getInstance().init();
			GameManager.getInstance().start(this);
		} else if (_buttonHelp == v) {
			startActivity(new Intent(PauseActivity.this, HelpLevelActivity.class));
		} else if (_buttonMenu == v) {
			GameManager.getInstance().init();
			finish();
		}
	}
}